# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=fdm
pkgver=2.2
pkgrel=0
pkgdesc="A simple lightweight tool of fetching, filtering and delivering emails"
url="https://github.com/nicm/fdm"
arch="all"
license="ISC"
makedepends="
	openssl-dev>3
	pcre2-dev
	tdb-dev
	zlib-dev
	"
subpackages="$pkgname-doc"
source="https://github.com/nicm/fdm/releases/download/$pkgver/fdm-$pkgver.tar.gz
	$pkgname-pcre2-fix.patch::https://github.com/nicm/fdm/commit/f1ec1982725d60045c0d871f3e613f2880046c22.patch
	"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-pcre2
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
13efa0f272c5f6146b90e094602e8a9b52016af79ae0b6cd80dc9f36b2ba37f64cadae7313bd8db90bcb007dd07206a3614987f11bb82c3535e04f0511c9fc6d  fdm-2.2.tar.gz
408da5b9ee9936fb198cdeb5bf3ad8e350845e9d0b009830d933cde0d5f8175c573a526ade42459ee32ddf7b1354a254c284214891f61afa16e71296bf53b71d  fdm-pcre2-fix.patch
"
